/*
 * 编辑
 */
function view(id) {
    window.location.href = viewUrl + "&order_hotel_id=" + id;
    //dialog.iframeOpen(editUrl + "&id=" + id, "编辑订单", 1100, 500);
}
/*
 * 
 */
function add() {
    dialog.iframeOpen(addUrl, "新增订单", 1000, 690);
}

/*
 * 
 */
function edit(id) {
    dialog.iframeOpen(editUrl + "&id=" + id, "修改订单", 1000, 690);
}

function batchDelOrder() {
    layer.confirm('删除选中订单，将删除该订单的相关一切数据！<br>确定删除吗？', function (index) {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: doDelUrl,
            data: {

            },
            success: function (data) {
                if (data.flag) {
                    dialog.msg(data.msg, 1);
                    setTimeout(function () {
                        window.location.reload();
                    }, 1000);
                } else {
                    dialog.alert(data.msg);
                }
            }
        });
        layer.close(index);
    });
}

function batchAddPaiche(id) {
    dialog.iframeOpen(batchAddPaicheUrl, "派车作业", 600, 400);
}

function addSecondOrder() {
    dialog.iframeOpen(addSecondOrderUrl, "新增二次运输订单", 1000, 550);
}

function batchCancelPaiche() {
    layer.confirm('取消派车，订单将回到【已制单】未派车状态 ！<br>确定取消派车吗？', function (index) {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: doBatchCancelPaicheUrl,
            data: {

            },
            success: function (data) {
                if (data.flag) {
                    dialog.msg(data.msg, 1);
                    setTimeout(function () {
                        window.location.reload();
                    }, 1000);
                } else {
                    dialog.alert(data.msg);
                }
            }
        });
        layer.close(index);
    });
}


function viewOrderFee(type_id) {
    dialog.iframeOpen(viewOrderFeeUrl + "&type_id=" + type_id, type_id == 1 ? "应收管理" : "应付管理", 1000, 500);
}